//
//  weixin.m
//  BaseFrame
//
//  Created by 吕金状 on 2017/9/6.
//  Copyright © 2017年 com.mxh. All rights reserved.
//

#import "weixin.h"

@implementation weixin

- (void)onResp:(BaseResp*)resp{
    __weak __typeof(self)weakSelf = self;
    
    //微信支付
    if([resp isKindOfClass:[PayResp class]]){
        //支付返回结果，实际支付结果需要去微信服务器端查询
        switch (resp.errCode) {
            case WXSuccess:{
                //微信支付
                [[NSNotificationCenter defaultCenter] postNotificationName:@"微信支付成功" object:nil userInfo:nil];
            }
            break;
                
            default:
                NSLog(@"错误，retcode = %d, retstr = %@", resp.errCode,resp.errStr);
                if (resp.errCode == -2) {
//                    ShowMessage(@"用户中途取消");
                    [[NSNotificationCenter defaultCenter] postNotificationName:@"微信支付用户中途取消" object:nil userInfo:nil];
                }else{
//                    ShowMessage(@"支付失败");
                    [[NSNotificationCenter defaultCenter] postNotificationName:@"微信支付用户支付失败" object:nil userInfo:nil];
                }
                break;
        }
    }
    
    //微信登录
    if ([resp isKindOfClass:[SendAuthResp class]]){
        SendAuthResp *rep = (SendAuthResp *)resp;
        if (rep.errCode == 0) {
//            [[NSNotificationCenter defaultCenter] postNotificationName:WXLoginSuccess object:@{@"WXLoginCode":rep.code}];
        }
    }
}



@end
